import unittest

from nose_parameterized import parameterized
from python接口测试.FIC_项目代号.tools_第三方工具包.bulid_data import bulid_data_db
from python接口测试.FIC_项目代号.api_测试接口.LaoHuangLi import LaoHuangLi
import requests
class testLaoHuangLi03(unittest.TestCase):

    def setUp(self) -> None:
        # 导入api 接口
        self.laohuangli =LaoHuangLi()
        self.session = requests.Session()
    def tearDown(self) -> None:
        if self.session :
            self.session.close()

    @parameterized.expand(bulid_data_db())
    def testLaoHuangLi03(self,key,date,reason,error_code):
        response = self.laohuangli.getLaoHuangLi(self.session,key,date)
        self.assertEqual(200,response.status_code)
        self.assertEqual(reason, response.json().get("reason"))
        self.assertEqual(int(error_code), response.json().get("error_code"))



